package com.simplefaith.delisty;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

import com.simplefaith.delisty.model.SwitchActivityHandler;
import com.simplefaith.delisty.model.SwitchSplashHandler;
import com.simplefaith.delisty.util.ActivityStackControlUtil;

public class SplashActivity extends Activity {

	private final int SPLASH_DISPLAY_LENGTH1 = 1000,
			SPLASH_DISPLAY_LENGTH2 = 2000, SPLASH_DISPLAY_LENGTH3 = 3000;

	private int activity[] = { R.layout.activity_splash1,
			R.layout.activity_splash2, R.layout.activity_splash3 };

	/*************************/
	private SwitchSplashHandler switchToSplash2Handler = new SwitchSplashHandler(
			this, activity[1]);

	private SwitchSplashHandler switchToSplash3Handler = new SwitchSplashHandler(
			this, activity[2]);

	private SwitchActivityHandler switchActivityHandler = new SwitchActivityHandler(
			this, LoginActivity.class, true);

	@Override
	protected void onCreate(Bundle savedBundleInstance) {

		super.onCreate(savedBundleInstance);

		ActivityStackControlUtil.add(this);
		// hide title
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);

		// set view
		setContentView(activity[0]);

		// set switch activity Handler
		switchToSplash2Handler.startHandler(SPLASH_DISPLAY_LENGTH1);

		switchToSplash3Handler.startHandler(SPLASH_DISPLAY_LENGTH2);

		switchActivityHandler.startHandler(SPLASH_DISPLAY_LENGTH3);

	}

	protected void onDestroy() {
		super.onDestroy();
		ActivityStackControlUtil.remove(this);
	}

}
